package com.tool.zip;

import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.model.enums.AesKeyStrength;
import net.lingala.zip4j.model.enums.CompressionMethod;
import net.lingala.zip4j.model.enums.EncryptionMethod;

public class ZipDemo {
    public static void main(String[] args) {
        ZipDemo zipDemo = new ZipDemo();
        zipDemo.zip();
    }
    public  void zip() {
        ZipParameters zipParameters = new ZipParameters();
        zipParameters.setCompressionMethod(CompressionMethod.STORE);
        zipParameters.setEncryptFiles(true);
        zipParameters.setEncryptionMethod(EncryptionMethod.AES);
        zipParameters.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_256);
        try {
            ZipFile zipFile = new ZipFile("F:\\aa.hedui", "11".toCharArray());
            zipFile.addFile("F:\\aa.txt", zipParameters);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
